package com.sinothk.base.nearby.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sinothk.base.nearby.entity.NearbySearchVo;
import com.sinothk.base.nearby.entity.UserBlogForNearbyDto;
import com.sinothk.base.nearby.entity.UserInfoForNearbyDTO;
import com.sinothk.base.nearby.service.INearbyBizService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description: 附近
 * @Author: Liangyt
 * @Date: 2022-03-29
 * @Version: V1.0
 */
@Api(tags = "附近")
@RestController
@RequestMapping("/nearby")
@Slf4j
public class NearbyBizController {

    @Autowired
    private INearbyBizService nearbyBizService;

    @AutoLog(value = "附近人-App分页列表")
    @ApiOperation(value = "附近人-App分页列表", notes = "附近人-App分页列表")
    @PostMapping(value = "/nearbyForUserPage")
    public Result<?> nearbyForUserPage(@RequestBody NearbySearchVo searchVo) {
        IPage<UserInfoForNearbyDTO> pageList = nearbyBizService.nearbyForUserPage(new Page<>(searchVo.getPageNo(), searchVo.getPageSize()), searchVo);
        return Result.OK(pageList);
    }


    @AutoLog(value = "附近博客-App分页列表")
    @ApiOperation(value = "附近博客-App分页列表", notes = "附近博客-App分页列表")
    @GetMapping(value = "/nearbyForBlogPage")
    public Result<?> nearbyForBlogPage(@RequestBody NearbySearchVo searchVo) {
        IPage<UserBlogForNearbyDto> pageList = nearbyBizService.nearbyForBlogPage(new Page<>(searchVo.getPageNo(), searchVo.getPageSize()), searchVo);
        return Result.OK(pageList);
    }

}
